﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="get_title_folder.aspx.cs" Inherits="SQT.tracnghiem.Ajax.ASP.Gallery.get_title_folder" %>

<%@ Import Namespace="DataAccess" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<body>
    <%var id = int.Parse(Request.QueryString["id"]);

      var get_file = new TblLibraryController().FetchAll().Where(x => x.LibraryId == id).Single();
      int parent = (int)get_file.LibraryParent;
      if (parent == 0)
      {
    %>
    <span class="gal-title"><i class="w3-hide folder_id">0</i>Tất cả thư mục</span>&nbsp;<i class="fa fa-angle-right"></i>&nbsp;<span class="gal-title gal-active w3-text-teal"><i class="w3-hide folder_id"><%=id %></i><%=get_file.LibraryName %></span>
    <%}else{
          string link = "&nbsp;<i class='fa fa-angle-right'></i>&nbsp;<span class='gal-title gal-active w3-text-teal'><i class='w3-hide folder_id'>" + id + "</i>" + get_file.LibraryName + "</span>";
          
          while (parent != 0)
          {
              var get_parent = new TblLibraryController().FetchAll().Where(x => x.LibraryId == parent).Single();
              parent = (int)get_parent.LibraryParent;
              string temp = link;
              link = "&nbsp;<i class='fa fa-angle-right'></i>&nbsp;<span class='gal-title'><i class='w3-hide folder_id'>" + get_parent.LibraryId + "</i>" + get_parent.LibraryName + "</span>";
              link += temp;
          }
          string temp2 = link;
          link = "<span class='gal-title'><i class='w3-hide folder_id'>0</i>Tất cả thư mục</span>";
          link += temp2;
          %>
    <%=link %>
    <%} %>
</body>
</html>
